import java.io.*;
import java.util.ArrayList;
import java.util.List;


public class test02 {

    public static int MAX_N = 500001;

    public static int[] tree = new int[MAX_N];

    public static int n, m;

    public static int lowbit(int x) {
        return x & -x;
    }

    public static void add(int i, int x) {
        while (i <= n) {
            tree[i] += x;
            i += lowbit(i);
        }
    }

    public static int sum(int i) {
        int res = 0;
        while (i > 0) {
            res += tree[i];
            i -= lowbit(i);
        }
        return res;
    }

    public static int getSum(int l, int r) {
        return sum(r) - sum(l - 1);
    }


    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        while (in.nextToken() != StreamTokenizer.TT_EOF) {
            n = (int) in.nval;
            in.nextToken();
            m = (int) in.nval;
            for (int i = 1, x = 0; i <= n; i++) {
                in.nextToken();
                x = (int) in.nval;
                add(i, x);
                add(i+1, -x);
            }
            for (int i = 0, op, x, y, v, index = 0; i < m; i++) {
                in.nextToken();
                op = (int) in.nval;
                if (op == 1) {
                    in.nextToken();
                    x = (int) in.nval;
                    in.nextToken();
                    y = (int) in.nval;
                    in.nextToken();
                    v = (int) in.nval;
                    add(x, v);
                    add(y + 1, -v);
                } else {
                    in.nextToken();
                    index = (int) in.nval;
                    out.println(sum(index));
                }
            }
        }
        out.flush();
        out.close();
        br.close();
    }
}